<div class="posts home">
<div class="widfats">
    <!-- Post by Post Term -->
    <div class="widget" id="widget_all_posts">
        <div class="toggle">&nbsp;</div>
        <h3 class="handle"><?php __('All Posts'); ?></h3>
        <div class="content">
            <div class="posts home">
                <?php if(count($terms)): ?>
                    <!-- Print post term tabs -->
                    <ul class="tabs post_terms">
                    <?php foreach($terms as $i=>$term): ?>
                        <li><a href="javascript:void(0)"><?php e($term['PostTerm']['name']); ?></a></li>
                    <?php endforeach; ?>
                    </ul>
                    <!-- Print post list -->
                    <?php App::import('Sanitize'); ?>
                    <div class="panes posts">
                    <?php foreach($terms as $i=>$term): ?>
                        <ul class="post_list">
                        <?php if(!empty($term['Post'])): ?>
                            <?php foreach($term['Post'] as $i=>$post):

                                $class = $post['attachment_count'] > 0 ? ' has_attachment' : '';?>
                                <li class="post_item<?php echo $class; ?>">
                                    <?php e($html->link(
                                        sprintf('%s(%s)',
 $post['title'], $time->format($options['shortDateFormat'], $post['created'])),
                                        array('controller'=>'posts','action'=>'view',$post['id']),
                                        array('title'=>$text->truncate(Sanitize::stripAll(strip_tags($post['content'])), 180))
                                    )); ?>
                                </li>
                            <?php endforeach; ?>
                        <?php else: ?>
                            <p><?php __('No post under this term'); ?></p>
                        <?php endif; ?>
                        </ul>
                    <?php endforeach; ?>
                </div>
                <?php else: ?>
                    <p><?php __('No post term'); ?></p>
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>

<div class="sidebar">
    <!-- Company list by created -->
    <div class="widget" id="widget_hot_posts">
        <div class="toggle">&nbsp;</div>
        <h3 class="handle"><?php __('Hot Posts'); ?></h3>
        <div class="content">
            <ul class="post_list">
            <?php if(!empty($hots)): ?>
                <?php foreach($hots as $i=>$hot): ?>
                    <li class="post_item">
                        <?php e($html->link(sprintf('%s(%s)', $text->truncate($hot['Post']['title'], 16), $hot['Post']['clicks']),
                            array('controller'=>'posts','action'=>'view',$hot['Post']['id']),
                            array('rev'=>'external')
                        )); ?>
                    </li>
                <?php endforeach; ?>
            <?php else: ?>
                <p><?php __('No post under this term'); ?></p>
            <?php endif; ?>
            </ul>
        </div>
    </div>
    <!-- Job list by created -->
    <!-- div class="widget" id="widget_tag_cloud">
        <div class="toggle">&nbsp;</div>
        <h3 class="handle"><?php __('Tag Cloud'); ?></h3>
        <div class="content">
        </div>
    </div -->
</div>
</div>
<!-- bind Job title toggler for job content -->
<script type="text/javascript">
jQuery(function(){
    $('ul.tabs').tabs('div.panes ul');
    $('#widget_all_posts').css('min-height', '300px');
    var options = {
        position: 'center center',
        offset: [110, 200],
        tip: '#abstract',
        lazy: false,
        effect: 'slide'
    };
    $('#widget_all_posts a[title]')
        .tooltip(options)
        .dynamic({
        right: {
            direction: 'down',
            bounce: true
        }
    });
    $('#widget_hot_posts a[title]').tooltip($.extend(options, {
        offset: [36, 0]
    })).dynamic({
        left: {
            direction: 'down',
            bounce: true
        }
    });
});
</script>
